class observer {
	constructor(data) {
		this.walk(data)
	}
	walk(data) {
		if (!data || typeof data !== 'object') {
			return
		}
		Object.keys(data).forEach(key => {
			this.defineReactive(data, key, data[key]) 
		})
	}
	defineReactive(obj, key, val) {
		let that = this
		this.walk(val)		
		Object.defineProperty(obj,key,{
			emunerable:true,
			configurable:true,
			get(){
				return val
			},
			set(newValue){
				if(newValue === val[key]){
					return
				}
				val = newValue
				that.walk(newValue)
			}
		})
	}
}
